home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
58519
/
58519.xpi
/
chrome
/
nasatabs.jar
/
content
/
script.js
< prev
next >
Wrap
Text File
|
2010-01-25
|
5KB
|
73 lines
var NasaTabsPref = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
var NasaTabs = {
init: function() {
var getTheme = NasaTabsPref.getCharPref("general.skins.selectedSkin");
var tabNasa = NasaTabsPref.getBoolPref("extensions.nasatabs.shownasa");
var favNasa = NasaTabsPref.getBoolPref("extensions.nasatabs.hidenasafav");
var tabNoia = NasaTabsPref.getBoolPref("extensions.nasatabs.shownoia");
var tabNoia2 = NasaTabsPref.getBoolPref("extensions.nasatabs.shownoia2");
var favNoia = NasaTabsPref.getBoolPref("extensions.nasatabs.hidenoiafav");
var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService (Components.interfaces.nsIStyleSheetService);
var thisCSS1 = "chrome://nasatabs/skin/common.css"; var thisCSS2 = "chrome://nasatabs/skin/nasa.css";
var thisCSS3 = "chrome://nasatabs/skin/shownasa.css"; var thisCSS4 = "chrome://nasatabs/skin/noia.css";
var thisCSS5 = "chrome://nasatabs/skin/noia2.css"; var thisCSS6 = "chrome://nasatabs/skin/shownoia.css";
var thisCSS7 = "chrome://nasatabs/skin/shownoia2.css";
var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var commonTheme = ios.newURI(thisCSS1, null, null); var nasaTheme = ios.newURI(thisCSS2, null, null);
var showNasa = ios.newURI(thisCSS3, null, null); var noiaTheme = ios.newURI(thisCSS4, null, null);
var noia2Theme = ios.newURI(thisCSS5, null, null); var showNoia = ios.newURI(thisCSS6, null, null);
var showNoia2 = ios.newURI(thisCSS7, null, null);
if (getTheme == "nasanightlaunch" && tabNasa) {sss.loadAndRegisterSheet(commonTheme, sss.USER_SHEET);
sss.loadAndRegisterSheet(nasaTheme, sss.USER_SHEET);
if (favNasa) {sss.loadAndRegisterSheet(showNasa, sss.USER_SHEET);}}
if (getTheme == "Noia2f" && tabNoia) {sss.loadAndRegisterSheet(commonTheme, sss.USER_SHEET);
sss.loadAndRegisterSheet(noiaTheme, sss.USER_SHEET);
if(favNoia) {sss.loadAndRegisterSheet(showNoia, sss.USER_SHEET);}}
if (getTheme == "Noia2f" && tabNoia2) {sss.loadAndRegisterSheet(commonTheme, sss.USER_SHEET);
sss.loadAndRegisterSheet(noia2Theme, sss.USER_SHEET);
if (favNoia) {sss.loadAndRegisterSheet(showNoia2, sss.USER_SHEET);}}
},
init2: function () {
try {var a = document.getElementById("nasa_1"); var b = document.getElementById("nasaFav");
var c = document.getElementById("noia_1"); var d = document.getElementById("noia_2");
var e = document.getElementById("noiaFav");
b.disabled = !a.checked;
if (c.checked || d.checked) {e.setAttribute("disabled", "false");
} else {e.setAttribute("disabled", "true");}
} catch(ex) {}
},
on_Nasa: function() {
var a = document.getElementById("nasa_1"); var b = document.getElementById("nasaFav");
b.disabled = !a.checked;
},
on_Noia: function() {
var c = document.getElementById("noia_1"); var d = document.getElementById("noia_2");
var e = document.getElementById("noiaFav");
c.checked = c.checked; d.setAttribute("checked", false);
if (c.checked || d.checked) {e.setAttribute("disabled", "false");} else {e.setAttribute("disabled", "true");}
},
on_Noia2: function() {
var c = document.getElementById("noia_1"); var d = document.getElementById("noia_2");
var e = document.getElementById("noiaFav");
d.checked = d.checked; c.setAttribute("checked", "false");
if (c.checked || d.checked) {e.setAttribute("disabled", "false");} else {e.setAttribute("disabled", "true");}
},
on_Restart: function() {
var appStartup = Components.interfaces.nsIAppStartup; var a = document.getElementById("nasa_1");
var b = document.getElementById("nasaFav"); var c = document.getElementById("noia_1");
var d = document.getElementById("noia_2"); var e = document.getElementById("noiaFav");
NasaTabsPref.setBoolPref("extensions.nasatabs.shownasa", a.checked);
NasaTabsPref.setBoolPref("extensions.nasatabs.hidenasafav", b.checked);
NasaTabsPref.setBoolPref("extensions.nasatabs.shownoia", c.checked);
NasaTabsPref.setBoolPref("extensions.nasatabs.shownoia2", d.checked);
NasaTabsPref.setBoolPref("extensions.nasatabs.hidenoiafav", e.checked);
b.disabled = !d;
if (c.checked || d.checked) {e.setAttribute("disabled", "false");} else {e.setAttribute("disabled", "true");}
Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(appStartup).quit
(appStartup.eRestart | appStartup.eAttemptQuit);
return true;
}
}
window.addEventListener("load", function() {NasaTabs.init();}, false);
window.addEventListener("load", function() {NasaTabs.init2();}, false);